yabplot example use¶

work-in-progress examples of plotting data on cortical surfaces, subcortical structures, and white matter tracts

subcortical plots¶

In [1]:
from yabplot import plot_subcortical

print('\nsubcortical brainnetome-sc atlas, with default lighting and all views:')
p = plot_subcortical(atlas='brainnetome_sc')

print('\nsubcortical aseg atlas, with sculpted lighting:')
p = plot_subcortical(atlas='aseg', style='sculpted', figsize=(1000, 300),
                     views=['left_lateral', 'left_medial', 'superior', 'anterior'])

print('\nsubcortical aseg atlas with data, with matte lighting:')
data = {'Left_Hippocampus': 0.6, 'Left_Amygdala': -0.2,
        'Left_Putamen': 0.9, 'Left_Thalamus': -0.9}
p = plot_subcortical(data=data, atlas='aseg', style='matte', figsize=(1000, 300),
                     views=['left_lateral', 'left_medial', 'superior', 'anterior'])

print('\nsubcortical aseg atlas with data with modified brainmesh and in 2D:')
p = plot_subcortical(data=data, atlas='aseg', style='flat', figsize=(1000, 300),
                     views=['left_lateral', 'left_medial', 'superior', 'anterior'],
                     bmesh_color='gray', bmesh_alpha=0.05)
subcortical brainnetome-sc atlas, with default lighting and all views:
No description has been provided for this image
subcortical aseg atlas, with sculpted lighting:
No description has been provided for this image
subcortical aseg atlas with data, with matte lighting:
No description has been provided for this image
subcortical aseg atlas with data with modified brainmesh and in 2D:
No description has been provided for this image

white matter tract plots¶

In [2]:
from yabplot import plot_tracts

print('\nxtract atlas, with default lighting, custom brainmesh, custom 4x4 layout and streamline orientation coloring:')
p = plot_tracts(atlas='xtract_tiny', layout=(2, 2), zoom=1.4, style='default',
                views=['left_lateral', 'left_medial', 'superior', 'anterior'],
                bmesh_type='fsaverage', orientation_coloring=True)

print('\nxtract atlas, with matte lighting, custom brainmesh, custom 4x4 layout and colored by tracts:')
p = plot_tracts(atlas='xtract_tiny', layout=(2, 2), zoom=1.4, style='matte',
                views=['left_lateral', 'left_medial', 'superior', 'anterior'],
                bmesh_type='fsaverage', )

print('\nxtract atlas with data, with matte lighting, custom brainmesh and custom 4x4 layout:')
data = {
    'FMaj': 0.7, 'FMin': 0.9, 'CRT_L': 0.9, 'IFOF_L': -0.5, 'ILF_L': -0.9,
    'UF_L': 0.2, 'ATR_L': 0.5, 'SLF2_L': 0.2, 'SLF3_L': 0.2,
}
p = plot_tracts(atlas='xtract_tiny', data=data, layout=(2, 2), zoom=1.4, style='matte',
                views=['left_lateral', 'left_medial', 'superior', 'anterior'],
                bmesh_type='fsaverage', )

print('\nxtract atlas with data, with matte lighting, custom brainmesh and interactive display:')
p = plot_tracts(atlas='xtract_tiny', data=data, layout=(1, 1), zoom=1.4, style='matte',
                bmesh_type='fsaverage', views=['superior'], display_type='interactive')
xtract atlas, with default lighting, custom brainmesh, custom 4x4 layout and streamline orientation coloring:
No description has been provided for this image
xtract atlas, with matte lighting, custom brainmesh, custom 4x4 layout and colored by tracts:
No description has been provided for this image
xtract atlas with data, with matte lighting, custom brainmesh and custom 4x4 layout:
No description has been provided for this image
xtract atlas with data, with matte lighting, custom brainmesh and interactive display:
Widget(value='<iframe src="http://localhost:52664/index.html?ui=P_0x16a70b6d0_7&reconnect=auto" class="pyvista…

cortical plots¶

In [3]:
import numpy as np
import pandas as pd
from yabplot import plot_cortical

print('\naparc atlas, with default lighting:')
plot_cortical(atlas='aparc', style='default')

print('\nschaefer_400 atlas, with default lighting:')
plot_cortical(atlas='schaefer_400', style='default')

print('\nschaefer_1000 atlas, with sculpted lighting:')
plot_cortical(atlas='schaefer_1000', style='sculpted')

print('\nschaefer_1000 atlas with data, with sculpted lighting:')
d_gr = pd.read_csv('/Users/to8050an/Documents/data/margulies_gradients.csv')
p = plot_cortical(data=np.array(d_gr['gradient1']), atlas='schaefer_1000')

print('\nschaefer_1000 atlas with data, with glossy lighting, custom minmax and interactive:')
p = plot_cortical(data=np.array(d_gr['gradient1']), atlas='schaefer_1000',
                  views=['superior'], layout=(1,1), display_type='interactive',
                  vminmax=[-3, 3], style='glossy')
aparc atlas, with default lighting:
No description has been provided for this image
schaefer_400 atlas, with default lighting:
No description has been provided for this image
schaefer_1000 atlas, with sculpted lighting:
No description has been provided for this image
schaefer_1000 atlas with data, with sculpted lighting:
No description has been provided for this image
schaefer_1000 atlas with data, with glossy lighting, custom minmax and interactive:
Widget(value='<iframe src="http://localhost:52664/index.html?ui=P_0x368d15250_12&reconnect=auto" class="pyvist…
In [ ]: